package com.lccviolet;

/**
 * @author LiChaochao
 * @Date 2021/9/21 16:06
 * @Description GC参数及调优
 */
public class GCParameter {

    public static void main(String[] args) throws InterruptedException {
        // 返回jvm内存初始大小，默认1/64
        long totalMemory = Runtime.getRuntime().totalMemory();
        // 返回jvm内存最大量，默认1/4
        long maxMemory = Runtime.getRuntime().maxMemory();

        System.out.println("totalMemory(-Xms) = " + totalMemory + "字节，" + (totalMemory/(double)1024/1024) + "MB");
        System.out.println("maxMemory(-Xmx) = " + maxMemory + "字节，" + (maxMemory/(double)1024/1024) + "MB");

        System.out.println("*******************GC");

        Thread.sleep(Integer.MAX_VALUE);
    }
}
